package am.NotenProgramm.objects;

public class SettingsData {

	String standartProfileName = "Default";
	String language = "de"; // Supported: de, en
	int width = 800;
	int height = 600;

	// Constructor to create without any details (set later)
	public SettingsData() {

	}

	// Constructor to create with all details
	public SettingsData(String standartProfileName, String language, int width,
			int height) {
		this.standartProfileName = standartProfileName;
		this.language = language;
		this.width = width;
		this.height = height;
	}

	// Constructor to load data from a loaded String
	public SettingsData(String fromString) {
		String tmpString = fromString;
		String[] splitedElements = tmpString.split("<,>");
		// Search splitted String for data-tags
		for (int i = 0; i < splitedElements.length; i++) {
			if (splitedElements[i].startsWith("standartProfileName=")) {
				standartProfileName = splitedElements[i].substring(20);
			} else if (splitedElements[i].startsWith("language=")) {
				language = splitedElements[i].substring(9);
			} else if (splitedElements[i].startsWith("width=")) {
				width = Integer.parseInt((splitedElements[i].substring(6)));
			} else if (splitedElements[i].startsWith("height=")) {
				height = Integer.parseInt(splitedElements[i].substring(7));
			}
		}
	}

	// Generate String to Save in a file
	@Override
	public String toString() {
		return "standartProfileName=" + standartProfileName + "<,>language="
				+ language + "<,>width=" + width + "<,>height=" + height;
	}

	// Getters and Setters
	public String getStandartProfileName() {
		return standartProfileName;
	}

	public void setStandartProfileName(String standartProfileName) {
		this.standartProfileName = standartProfileName;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}
}